package br.unisinos.tetris.command;

import br.unisinos.tetris.engine.Controller;
import br.unisinos.tetris.pieces.Piece;
import br.unisinos.tetris.state.PieceState;
import br.unisinos.tetris.view.TetrisApp;
import br.unisinos.tetris.view.TetrisView;

public class MoveLeftCommand implements Command {

	@Override
	public void run() {
		PieceState state = Controller.getInstance().getCurrentPiece();
		Piece piece = state.getPiece();
		piece.setX(piece.getX() - 10);
		TetrisView view = (TetrisView) TetrisApp.getApplication().getMainView();
		state.paint(view.getMainPanel());
		view.getMainPanel().repaint();
	}

}
